package com.yinNuo.collectWool.collectWoolHttp;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.yinNuo.collectWool.core.constant.TencentZiXuanGuConstant;
import com.yinNuo.collectWool.utils.HttpUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;

/**
 * @author: yinNuo
 * create at: 2021/12/13 下午8:36
 * @description: 腾讯自选股
 */
@Component
public class TencentZiXuanGuHttp {
    @Autowired
    HttpUtils httpUtils;

    /**
     * 获取票据  所有任务都是从这儿获取票据，请求的参数都是一样的，
     */
    public String getPiaoJu(String param){
        HttpHeaders headers = new HttpHeaders();
        String responseBody = httpUtils.getMethod(TencentZiXuanGuConstant.TENG_XUN_ZI_XUAN_GU + param, headers , null);
        JSONObject jsonObject = JSONUtil.parseObj(responseBody);
        return jsonObject.getStr("task_ticket");
    }

    /**
     * 查看选股卡页
     * param 请求参数
     * @return
     */
    public String chaKaXuanGuKa(String param) {
        HttpHeaders headers = new HttpHeaders();
        String responseBody = httpUtils.getMethod(TencentZiXuanGuConstant.TENG_XUN_ZI_XUAN_GU + param, headers, null);
        JSONObject jsonObject = JSONUtil.parseObj(responseBody);
        return jsonObject.toString();
    }

    /**
     * 查看今日大盘行情
     * param 请求参数
     * @return
     */
    public String chaKaDaPanHangQing(String param) {
        HttpHeaders headers = new HttpHeaders();
        String responseBody = httpUtils.getMethod(TencentZiXuanGuConstant.TENG_XUN_ZI_XUAN_GU + param, headers, null);
        JSONObject jsonObject = JSONUtil.parseObj(responseBody);
        return jsonObject.toString();
    }

    /**
     * 阅读一篇咨询
     * param 请求参数
     * @return
     */
    public String yueDuZiXun(String param) {
        HttpHeaders headers = new HttpHeaders();
        String responseBody = httpUtils.getMethod(TencentZiXuanGuConstant.TENG_XUN_ZI_XUAN_GU + param, headers, null);
        JSONObject jsonObject = JSONUtil.parseObj(responseBody);
        return jsonObject.toString();
    }

    /**
     * 通过推荐首页加自持
     * param 请求参数
     * @return
     */
    public String tuiJianShouYeJiaZiChi(String param) {
        HttpHeaders headers = new HttpHeaders();
        String responseBody = httpUtils.getMethod(TencentZiXuanGuConstant.TENG_XUN_ZI_XUAN_GU + param, headers, null);
        JSONObject jsonObject = JSONUtil.parseObj(responseBody);
        return jsonObject.toString();
    }

    /**
     * 完成猜涨跌游戏
     * param 请求参数
     * @return
     */
    public String caiZhangDieYouXi(String param) {
        HttpHeaders headers = new HttpHeaders();
        String responseBody = httpUtils.getMethod(TencentZiXuanGuConstant.TENG_XUN_ZI_XUAN_GU + param, headers, null);
        JSONObject jsonObject = JSONUtil.parseObj(responseBody);
        return jsonObject.toString();
    }

    /**
     * 点赞股票评论
     * param 请求参数
     * @return
     */
    public String dianZanPingLun(String param) {
        HttpHeaders headers = new HttpHeaders();
        String responseBody = httpUtils.getMethod(TencentZiXuanGuConstant.TENG_XUN_ZI_XUAN_GU + param, headers, null);
        JSONObject jsonObject = JSONUtil.parseObj(responseBody);
        return jsonObject.toString();
    }

    /**
     * 查看热搜，添加自选
     * param 请求参数
     * @return
     */
    public String resouZiXuan(String param) {
        HttpHeaders headers = new HttpHeaders();
        String responseBody = httpUtils.getMethod(TencentZiXuanGuConstant.TENG_XUN_ZI_XUAN_GU + param, headers, null);
        JSONObject jsonObject = JSONUtil.parseObj(responseBody);
        return jsonObject.toString();
    }

    /**
     * 关注账号
     * param 请求参数
     * @return
     */
    public String guanZhuZhangHao(String param) {
        HttpHeaders headers = new HttpHeaders();
        String responseBody = httpUtils.getMethod(TencentZiXuanGuConstant.TENG_XUN_ZI_XUAN_GU + param, headers, null);
        JSONObject jsonObject = JSONUtil.parseObj(responseBody);
        return jsonObject.toString();
    }



}
